<template>
  <div class="modal">
    <div class="mask"></div>
    <div class="content">
      <div>
        <slot name="body"></slot>
      </div>
      <div v-if="btnType == 1" class="new">
        <button @click="submit">确定</button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { defineProps, defineEmits } from 'vue'
import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
const route = useRoute()
const router = useRouter()

const emits = defineEmits(['submit'])
let props = defineProps({
  btnType: {
    type: true,
    reuired: true
  }
})
const submit = () => {
  emits('submit')
  router.push('/')
}
</script>

<style lang="scss" scoped>
.modal {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99;
}

.mask {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.2);
}

.conent {
  width: 3rem;
  height: 2rem;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
}
.new {
  z-index: 999;
}
</style>